<?php
namespace app\sendmsg\model;

use think\Model;

class SendConfig extends Model
{

    protected $name = 'longbing_card_send_config';


    /**
     * @author chenniang
     * @DataTime: 2020-04-28 11:51
     * @功能说明:添加配置
     */
    public function configAdd($insert){

        $res = $this->insert($insert);

        return $res;

    }


    /**
     * @author chenniang
     * @DataTime: 2020-04-28 11:52
     * @功能说明:获取配置
     */
    public function configInfo($dis){


        $data = $this->where($dis)->find();

        if(empty($data)){

            $res = $this->configAdd($dis);

            $data = $this->where($dis)->find();

        }

        return $data;
    }


    /**
     * @author chenniang
     * @DataTime: 2020-04-28 11:53
     * @功能说明:修改配置
     */
    public function configUpdate($dis,$data){

        $res = $this->where($dis)->update($data);

        return $res;

    }



}